﻿@using AP.Framework.Infrastructure.Repositories
@using AP.Framework.Infrastructure.Database
@{
    ViewBag.Title = "主页";
    Layout = "~/Views/Shared/_Web960Layout.cshtml";
}
@{
    ApContext context = new ApContext();
    ArticleRepository article = new ArticleRepository(context);
    LinkRepository link = new LinkRepository(context);
    ProductRepository product = new ProductRepository(context);
    CompanyProfileRepository comProfile = new CompanyProfileRepository(context);
   
}
<div class="grid_5">
    <div class="index-sider">
        <div class="section-wrap index-news">
            <div class="section-title section-mark clearfix">
                <a href="@Url.Action("Index", "News", null)"><em style="color: #1EA4E3">新闻动态</em></a></div>
            <div class="section-content">
                <ul class="links-list">
                    @{
                        var articleList = article.GetAll().Take(10).ToList();
                        foreach (var art in articleList)
                        {
                        <li><a href="@Url.Action("ViewDetails", "News", new { @articleId = art.ID })" class="title" title="">
                            @(art.Title ?? "")</a><span class="time">@(art.ModifyTime == null ? "" : art.ModifyTime.Value.ToShortDateString())</span>
                        </li>                        
                        }
                    }
                </ul>
            </div>
        </div>
        @Html.Partial("_ContactPartial")
        <div class="section-wrap index-news">
            <div class="section-title section-mark clearfix">
                <a href="@Url.Action("Index", "Links", null)"><em style="color: #1EA4E3">友情链接/合作资源方</em></a></div>
            <div class="section-content">
                <ul class="links-list" style="text-align: left;">
                    @{
                        var linkList = link.GetAll().OrderBy(p => p.Sequence).ToList();
                        foreach (var lin in linkList)
                        {
                        <li><a class="title"  href="@lin.SiteUrl">@(lin.Title ?? "")</a></li>                      
                        }
                    }
                </ul>
            </div>
        </div>
    </div>
</div>
<!-- end .grid_1 -->
<div class="grid_11">
    <div class="index-main">
        <div class="section-wrap index-service">
            <div class="section-title section-mark clearfix">
                <em style="color: #1EA4E3">公司简介</em> <a href="@Url.Action("Index", "Company", new { area = "" })" style="float: right; color: Red">
                    更多&gt;</a>
            </div>
            <div class="section-content">
                <table style="width: 100%;">
                    <tr>
                        <td>
                            <img style="padding: 5px" src="../../Content/themes/WebSite/images/company.jpg" alt="公司简介" />
                        </td>
                        <td>
                            @{
                                var comProfileList = comProfile.getCompanyList().FirstOrDefault();                       
                            }
                            @if (comProfileList != null)
                            {  
                                <div style="margin: 10px; padding: 5px; text-align: left; height: 190px; overflow: hidden;
                                    text-overflow: ellipsis;">
                                    &nbsp; &nbsp; &nbsp; &nbsp;@(Html.Raw(comProfileList.ZhaiYao))
                                </div>
                            }
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <div class="index-main">
        <div class="section-wrap index-service">
            <div class="section-title section-mark clearfix">
                <em style="color: #1EA4E3">产品展示</em> <a href="@Url.Action("Index", "Product", new { area = "" })" style="float: right; color: Red">
                    更多&gt;</a>
            </div>
            <div class="section-content">
                <div id="product-list">
                    <div id="plug0">
                        @{
                            var productList = product.GetAll().Where(p => p.IsDisable == false).OrderBy(p => p.Sequence).ToList().Take(8);
                            foreach (var pro in productList)
                            {                                                                   
                            <dl style="width: 140px; height: 170px;" class="column">
                                <dt>
                                    <img src="@(pro.Photo ?? "")" alt="" width=132 height=108 />
                                </dt>
                                <dd>
                                    <ul>
                                        <li>
                                            <h4 class="title">
                                                <a href="@Url.Action("ViewDetails", "Product", new { area = "", productId = pro.ID })">@(pro.Name ?? "")</a></h4>
                                        </li>
                                    </ul>
                                </dd>
                            </dl>                
                            }                  
                        }
                    </div>
                    <div style="clear: both;">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- end .grid_15 -->
<div class="clear">
</div>
